@*
* Copyright 2015 Yahoo Inc. Licensed under the Apache License, Version 2.0
* See accompanying LICENSE file.
*@
@(cluster:String, logkafka_id: String, log_path: String, logkafkaIdentity: kafka.manager.model.ActorModel.LogkafkaIdentity
)(implicit messages: play.api.i18n.Messages, request:RequestHeader)

<div class="card-body row">
    <div class="col-md-8">
        <div class="card">
            <div class="card-header"><h4>Logkafka Summary</h4></div>
            <div class="card-body">
            <table class="table">
                <tbody>
                <tr>
                    <td>Logkafka Id</td>
                    <td>@logkafka_id</td>
                <tr>
                    <td>Log Path</td>
                    <td>@log_path</td>
                </tr>
                </tbody>
            </table>
            @if(!logkafkaIdentity.identityMap.isEmpty && !logkafkaIdentity.identityMap.get(log_path).isEmpty) {
              @defining(logkafkaIdentity.identityMap.get(log_path).get) { identityTuple =>
                @if(identityTuple._1.isDefined) {
                <table class="table">
                    <thead>
                    <th>Config</th><th>Value</th>
                    </thead>
                    <tbody>
                    @identityTuple._1.map { config =>
                        @for((k, v) <- config) {
                            <tr>
                                <td>@k</td>
                                <td>@v</td>
                            </tr>
                        }
                    }
                    </tbody>
                </table>
                }
              }
            }
            </div>
        </div>
    </div>
    <div class="col-md-4">
        <div class="card">
            <div class="card-header"><h4>Operations</h4></div>
            <div class="card-body">
            <table class="table">
                <tbody>
                <tr>
                    <td>
                        @b4.vertical.form(routes.Logkafka.handleDeleteLogkafka(cluster, logkafka_id, log_path)) { implicit fc =>
                        <fieldset>
                            @b4.hidden("logkafka_id", logkafka_id)
                            @b4.hidden("log_path", log_path)
                            @b4.submit('class -> "submit-button btn btn-primary"){ Delete Logkafka }
                        </fieldset>
                        }
                    </td>
                </tr>
                <tr>
                    <td>
                        <a href="@routes.Logkafka.updateConfig(cluster,logkafka_id,log_path)" class="submit-button btn btn-primary" role="button">Update Config</a>
                    </td>
                </tr>
                </tbody>
            </table>
            </div>
        </div>
    </div>
</div>
